<%@language=vbscript%>
<%
	Session("FormName")="F26"
%>
<!--#include file="..\CheckSession.inc"-->
<!--#include file=..\getFormName.inc-->
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel=stylesheet href="..\CSS\FormStyle.css" type="text/css">
<script language="javascript" src="..\JS\toolBarButton.js"></script>
<title>Net.Office</title>
</head>
<%
bComm=request("bComm")
strdate=Request("strdate")
if strdate="" then
	strdate=date()
end if
btext=Request("DSCanbo")
if bComm="ok" then
Set RecDKL=server.CreateObject("ADODB.Recordset")
RecDKL.CursorType=3
RecDKL.CacheSize=5
sSQL="select * from lichtrucn where ngaythang='"& strdate &"' and madonvi='000000'"
RecDKL.Open sSQL,Conn
if RecDKL.Recordcount > 0 then
	sSQL="update lichtrucn set cbtruc='"& btext &"' where ngaythang='"& strdate &"' and madonvi='000000'"
	Conn.Execute sSQL
else
	sSQL="Insert into lichtrucn(ngaythang,cbtruc,madonvi) values ('"& strdate &"','"& btext &"','000000')"
	Conn.Execute sSQL
end if
RecDKL.close
Set RecDKL=nothing
End if
Set Rec=server.CreateObject("ADODB.Recordset")
Rec.CursorType=3
Rec.CacheSize=5
sSQL="select * from lichtrucn where ngaythang='"& strdate &"' and madonvi='000000'"
Rec.Open sSQL,Conn
if Rec.Recordcount > 0 then
	bcbtruc=Rec("cbtruc")
end if
Rec.close
Set Rec=nothing
%>
<script language=VBScript runat=server>
Function FormatDate(vDate)
	   If Not IsNull(vDate) Then
	        vM = Right("0" & Month(vDate), 2)
	        vD = Right("0" & Day(vDate), 2)
	        vY = Right("19" & Year(vDate), 4)
	        FormatDate = vD & "/" & vM & "/" & vY
	   End If
End Function
Function SaveDate(vDate)
		dim bvitri1
		dim bvitri2
	   vDate=trim(cstr(vDate))
	   bvitri1=instr(1,vDate,"/")
	   bMonth=left(vDate,bvitri1-1)
	   bvitri2=instr(bvitri1+1,vDate,"/")
	   Dim Temp
	   Temp=right(vDate,len(vDate)-bvitri1)
	   bDay=left(Temp,bvitri2-bvitri1-1)
	   bYear=right(vDate,len(vDate)-bvitri2)
       SaveDate=bDay+"/"+bMonth+"/"+bYear
End Function
Function Thu(strdate)
	bthu=weekday(strdate)
	select case bthu
		case 1
			Thu="Chủ Nhật"
		case 2
			Thu="Thứ Hai"
		case 3
			Thu="Thứ Ba"
		case 4
			Thu="Thứ Tư"
		case 5
			Thu="Thứ Năm"
		case 6
			Thu="Thứ Sáu"
		case 7
			Thu="Thứ Bảy"
	End select
End Function
</script>
<SCRIPT LANGUAGE=javascript>
<!--
function CmdBack_onclick() {
	frm.target="main";
	frm.action="../leftmain.asp";
	frm.submit();
}
function CmdOK_onclick() {
	frm.action="lichtructc.asp?bComm=ok&strdate="+"<%=strdate%>";
	frm.submit();
}
//-->
</script>
<script language="javascript">
function ShowCalender(){
frm.changedate.value="True";
showModalDialog("calendar.asp",window,"dialogWidth:4.9cm;dialogHeight:4.8cm;dialogTop:8cm;dialogLeft:5.4cm;Help:No;Resizable:No;Status:No;");
//remote = window.open('calendar.asp','new_page','width=175,height=153,top=215,left=2,Resizable=no').focus();
}
function onclick_changedate(){
	strcookie=document.cookie;
	intvt1=strcookie.indexOf("changedate=");
	intvt2=strcookie.indexOf(";",intvt1)
	strchangedate=strcookie.substr(intvt1+11,intvt2-intvt1-11)
	strdateold=frm.changedate.value;
	if (strdateold=="True"){
		frm.changedate.value="";
		frm.action="dangkylichtructc.asp?bdate=" + strchangedate;
		frm.target="dangkylichtruc";
		frm.submit();
		frm.action="lichtructc.asp?bComm=''&strdate=" + strchangedate;
		frm.target="laplichtruc";
		frm.submit();
	}
}
</script>
<body bgcolor="#D6D3CE" topmargin=0 leftmargin=0 rightmargin=0 style="FONT-FAMILY: Time New Roman" SCROLL=NO>
<form name=frm method=post onclick="javascript:onclick_changedate()">
<input type="hidden" name="changedate">
<table id=toolbar cellspacing="0">
	<tr><td> 
		<table cellspacing="0">
			<tr> 
				<td><img src="..\images\icons\button_seperator.gif" align="absmiddle" width="12" height="20"></td>
				<td class="toolBarButton" title="Lưu thông tin trực" id=btnghinhan onaction="CmdOK_onclick()"><img src="..\images\icons\button_save.gif" align="absmiddle" width="16" height="20">&nbsp;&nbsp;Ghi nhận</td>
				<td class="toolBarButton" title="Trở về của sổ chính" id=btnquaylai onaction="CmdBack_onclick()"><img src="..\images\icons\button_back.gif" align="absmiddle" width="16" height="20">&nbsp;Quay lại</td>
				<td><img src="..\images\icons\button_seperator.gif" align="absmiddle" width="12" height="20"></td>
				<td class="toolBarButton" title="Chọn ngày tháng" id=btncalendar onaction="ShowCalender()">&nbsp;<img src="..\images\button_calendarpop.gif" align="absmiddle" width="16" height="20">&nbsp;</td>
				<td class="toolBarButton"><b>&nbsp;<%=Thu(strdate)%>&nbsp;&nbsp;<%=FormatDate(strdate)%></b></td>
			</tr>
		</table>
	</tr></td>
</table>
<script>
var btn;
	btn = document.getElementById("btnghinhan");createButton(btn);btn.setEnabled(true);
	btn = document.getElementById("btnquaylai");createButton(btn);btn.setEnabled(true);
	btn = document.getElementById("btncalendar");createButton(btn);btn.setEnabled(true);
</script>
<table class=tblHeader id=ListHeader border=0 cellspacing=0 cellpadding=0>
	<tr>
		<td align="center">Danh sách cán bộ trực</td>
	</tr>
</table>
<table class=tbledit id=tbleditid border=0 cellspacing=0 cellpadding=0 width="100%">
<tr>
<td width="100%">
	<textarea rows=12 cols=80 style="font-size:12px ;font-family:arial;width:100%;height:192px" name=DSCanbo><%=bcbtruc%></textarea>
</td>
</tr>
</table>
</form>
</body>
</html>